<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>抖音爱心代码制作教程 | 小庞博客</title><meta name="author" content="Freely.Pzd"><meta name="copyright" content="Freely.Pzd"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="我们平时在刷抖音的时候有没有刷到过代码运行出爱心的视频呢？这篇文章就教大家如何制作代码爱心  制作爱心需要满足的条件了解一点HTML文本语言、了解代码如何使用 爱心界面制作效果图 这是个动态的哦！ 代码展示直接点击代码框右上角复制按钮 123456789101112131415161718192021222324252627282930313233343536373839404142434445">
<meta property="og:type" content="article">
<meta property="og:title" content="抖音爱心代码制作教程">
<meta property="og:url" content="https://www.freelypzd.cn/article/64334.html">
<meta property="og:site_name" content="小庞博客">
<meta property="og:description" content="我们平时在刷抖音的时候有没有刷到过代码运行出爱心的视频呢？这篇文章就教大家如何制作代码爱心  制作爱心需要满足的条件了解一点HTML文本语言、了解代码如何使用 爱心界面制作效果图 这是个动态的哦！ 代码展示直接点击代码框右上角复制按钮 123456789101112131415161718192021222324252627282930313233343536373839404142434445">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://s2.loli.net/2022/12/20/qViTKGCHS2AutNv.png">
<meta property="article:published_time" content="2022-11-25T09:01:59.000Z">
<meta property="article:modified_time" content="2023-01-12T11:33:03.330Z">
<meta property="article:author" content="Freely.Pzd">
<meta property="article:tag" content="趣味代码">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://s2.loli.net/2022/12/20/qViTKGCHS2AutNv.png"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://www.freelypzd.cn/article/64334"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":false,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":230},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '抖音爱心代码制作教程',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-01-12 19:33:03'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="/css/biaoti.css"><link rel="stylesheet" href="/css/back.css"><link rel="stylesheet" href="/css/font.css"><link rel="stylesheet" href="//at.alicdn.com/t/c/font_3378236_mwnc0z1zl4k.css"><meta name="generator" content="Hexo 5.4.2"><link rel="alternate" href="/atom.xml" title="小庞博客" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://s2.loli.net/2022/12/22/bWEYZPUedl7wftp.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">4</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">3</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/love/"><i class="fa-fw iconfont icon-xihuan"></i><span> Love</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw iconfont icon-wenzhang-copy"></i><span> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw iconfont icon-xiaoxi"></i><span> 社交</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></li><li><a class="site-page child" href="/about/"><i class="fa-fw iconfont icon-wode"></i><span> 关于我</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw iconfont icon-gengduo"></i><span> 其他</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/gallery/"><i class="fa-fw iconfont icon-tuku"></i><span> 图库</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://s2.loli.net/2022/12/20/qViTKGCHS2AutNv.png')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">小庞博客</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/love/"><i class="fa-fw iconfont icon-xihuan"></i><span> Love</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw iconfont icon-wenzhang-copy"></i><span> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw iconfont icon-xiaoxi"></i><span> 社交</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></li><li><a class="site-page child" href="/about/"><i class="fa-fw iconfont icon-wode"></i><span> 关于我</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw iconfont icon-gengduo"></i><span> 其他</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/gallery/"><i class="fa-fw iconfont icon-tuku"></i><span> 图库</span></a></li></ul></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">抖音爱心代码制作教程</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-11-25T09:01:59.000Z" title="发表于 2022-11-25 17:01:59">2022-11-25</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-12T11:33:03.330Z" title="更新于 2023-01-12 19:33:03">2023-01-12</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E6%8A%96%E9%9F%B3%E8%B6%A3%E5%91%B3%E4%BB%A3%E7%A0%81/">抖音趣味代码</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="抖音爱心代码制作教程"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><blockquote>
<p>我们平时在刷抖音的时候有没有刷到过代码运行出爱心的视频呢？<br>这篇文章就教大家如何制作代码爱心</p>
</blockquote>
<h2 id="制作爱心需要满足的条件"><a href="#制作爱心需要满足的条件" class="headerlink" title="制作爱心需要满足的条件"></a>制作爱心需要满足的条件</h2><p>了解一点HTML文本语言、了解代码如何使用</p>
<h2 id="爱心界面制作"><a href="#爱心界面制作" class="headerlink" title="爱心界面制作"></a>爱心界面制作</h2><h3 id="效果图"><a href="#效果图" class="headerlink" title="效果图"></a>效果图</h3><p><img src="https://s2.loli.net/2022/12/20/qViTKGCHS2AutNv.png" alt="效果图"></p>
<p>这是个动态的哦！</p>
<h3 id="代码展示"><a href="#代码展示" class="headerlink" title="代码展示"></a>代码展示</h3><p>直接点击代码框右上角复制按钮</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">HTML</span> <span class="keyword">PUBLIC</span> <span class="string">&quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">HTML</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">HEAD</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">TITLE</span>&gt;</span> ❤送你无数颗跳动的爱心 <span class="tag">&lt;/<span class="name">TITLE</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">META</span> <span class="attr">NAME</span>=<span class="string">&quot;Generator&quot;</span> <span class="attr">CONTENT</span>=<span class="string">&quot;EditPlus&quot;</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">META</span> <span class="attr">NAME</span>=<span class="string">&quot;Author&quot;</span> <span class="attr">CONTENT</span>=<span class="string">&quot;&quot;</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">META</span> <span class="attr">NAME</span>=<span class="string">&quot;Keywords&quot;</span> <span class="attr">CONTENT</span>=<span class="string">&quot;&quot;</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">META</span> <span class="attr">NAME</span>=<span class="string">&quot;Description&quot;</span> <span class="attr">CONTENT</span>=<span class="string">&quot;&quot;</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">style</span>&gt;</span><span class="language-css"></span></span><br><span class="line"><span class="language-css">  <span class="selector-tag">html</span>, <span class="selector-tag">body</span> &#123;</span></span><br><span class="line"><span class="language-css">  <span class="attribute">height</span>: <span class="number">100%</span>;</span></span><br><span class="line"><span class="language-css">  <span class="attribute">padding</span>: <span class="number">0</span>;</span></span><br><span class="line"><span class="language-css">  <span class="attribute">margin</span>: <span class="number">0</span>;</span></span><br><span class="line"><span class="language-css">  <span class="attribute">background</span>: <span class="number">#000</span>;</span></span><br><span class="line"><span class="language-css">&#125;</span></span><br><span class="line"><span class="language-css"><span class="selector-tag">canvas</span> &#123;</span></span><br><span class="line"><span class="language-css">  <span class="attribute">position</span>: absolute;</span></span><br><span class="line"><span class="language-css">  <span class="attribute">width</span>: <span class="number">100%</span>;</span></span><br><span class="line"><span class="language-css">  <span class="attribute">height</span>: <span class="number">100%</span>;</span></span><br><span class="line"><span class="language-css">&#125;</span></span><br><span class="line"><span class="language-css">  </span><span class="tag">&lt;/<span class="name">style</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">HEAD</span>&gt;</span></span><br><span class="line"></span><br><span class="line"> <span class="tag">&lt;<span class="name">BODY</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">canvas</span> <span class="attr">id</span>=<span class="string">&quot;pinkboard&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">canvas</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript">  <span class="comment">/*</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * Settings</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> */</span></span></span><br><span class="line"><span class="language-javascript"><span class="keyword">var</span> settings = &#123;</span></span><br><span class="line"><span class="language-javascript">  <span class="attr">particles</span>: &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="attr">length</span>:   <span class="number">500</span>, <span class="comment">// maximum amount of particles</span></span></span><br><span class="line"><span class="language-javascript">    <span class="attr">duration</span>:   <span class="number">2</span>, <span class="comment">// particle duration in sec</span></span></span><br><span class="line"><span class="language-javascript">    <span class="attr">velocity</span>: <span class="number">100</span>, <span class="comment">// particle velocity in pixels/sec</span></span></span><br><span class="line"><span class="language-javascript">    <span class="attr">effect</span>: -<span class="number">0.75</span>, <span class="comment">// play with this for a nice effect</span></span></span><br><span class="line"><span class="language-javascript">    <span class="attr">size</span>:      <span class="number">30</span>, <span class="comment">// particle size in pixels</span></span></span><br><span class="line"><span class="language-javascript">  &#125;,</span></span><br><span class="line"><span class="language-javascript">&#125;;</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"><span class="comment">/*</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * RequestAnimationFrame polyfill by Erik Möller</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> */</span></span></span><br><span class="line"><span class="language-javascript">(<span class="keyword">function</span>(<span class="params"></span>)&#123;<span class="keyword">var</span> b=<span class="number">0</span>;<span class="keyword">var</span> c=[<span class="string">&quot;ms&quot;</span>,<span class="string">&quot;moz&quot;</span>,<span class="string">&quot;webkit&quot;</span>,<span class="string">&quot;o&quot;</span>];<span class="keyword">for</span>(<span class="keyword">var</span> a=<span class="number">0</span>;a&lt;c.<span class="property">length</span>&amp;&amp;!<span class="variable language_">window</span>.<span class="property">requestAnimationFrame</span>;++a)&#123;<span class="variable language_">window</span>.<span class="property">requestAnimationFrame</span>=<span class="variable language_">window</span>[c[a]+<span class="string">&quot;RequestAnimationFrame&quot;</span>];<span class="variable language_">window</span>.<span class="property">cancelAnimationFrame</span>=<span class="variable language_">window</span>[c[a]+<span class="string">&quot;CancelAnimationFrame&quot;</span>]||<span class="variable language_">window</span>[c[a]+<span class="string">&quot;CancelRequestAnimationFrame&quot;</span>]&#125;<span class="keyword">if</span>(!<span class="variable language_">window</span>.<span class="property">requestAnimationFrame</span>)&#123;<span class="variable language_">window</span>.<span class="property">requestAnimationFrame</span>=<span class="keyword">function</span>(<span class="params">h,e</span>)&#123;<span class="keyword">var</span> d=<span class="keyword">new</span> <span class="title class_">Date</span>().<span class="title function_">getTime</span>();<span class="keyword">var</span> f=<span class="title class_">Math</span>.<span class="title function_">max</span>(<span class="number">0</span>,<span class="number">16</span>-(d-b));<span class="keyword">var</span> g=<span class="variable language_">window</span>.<span class="built_in">setTimeout</span>(<span class="keyword">function</span>(<span class="params"></span>)&#123;<span class="title function_">h</span>(d+f)&#125;,f);b=d+f;<span class="keyword">return</span> g&#125;&#125;<span class="keyword">if</span>(!<span class="variable language_">window</span>.<span class="property">cancelAnimationFrame</span>)&#123;<span class="variable language_">window</span>.<span class="property">cancelAnimationFrame</span>=<span class="keyword">function</span>(<span class="params">d</span>)&#123;<span class="built_in">clearTimeout</span>(d)&#125;&#125;&#125;());</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"><span class="comment">/*</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * Point class</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> */</span></span></span><br><span class="line"><span class="language-javascript"><span class="keyword">var</span> <span class="title class_">Point</span> = (<span class="keyword">function</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">function</span> <span class="title function_">Point</span>(<span class="params">x, y</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">x</span> = (<span class="keyword">typeof</span> x !== <span class="string">&#x27;undefined&#x27;</span>) ? x : <span class="number">0</span>;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">y</span> = (<span class="keyword">typeof</span> y !== <span class="string">&#x27;undefined&#x27;</span>) ? y : <span class="number">0</span>;</span></span><br><span class="line"><span class="language-javascript">  &#125;</span></span><br><span class="line"><span class="language-javascript">  <span class="title class_">Point</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">clone</span> = <span class="keyword">function</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">Point</span>(<span class="variable language_">this</span>.<span class="property">x</span>, <span class="variable language_">this</span>.<span class="property">y</span>);</span></span><br><span class="line"><span class="language-javascript">  &#125;;</span></span><br><span class="line"><span class="language-javascript">  <span class="title class_">Point</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">length</span> = <span class="keyword">function</span>(<span class="params">length</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">if</span> (<span class="keyword">typeof</span> length == <span class="string">&#x27;undefined&#x27;</span>)</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">return</span> <span class="title class_">Math</span>.<span class="title function_">sqrt</span>(<span class="variable language_">this</span>.<span class="property">x</span> * <span class="variable language_">this</span>.<span class="property">x</span> + <span class="variable language_">this</span>.<span class="property">y</span> * <span class="variable language_">this</span>.<span class="property">y</span>);</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="title function_">normalize</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">x</span> *= length;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">y</span> *= length;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">return</span> <span class="variable language_">this</span>;</span></span><br><span class="line"><span class="language-javascript">  &#125;;</span></span><br><span class="line"><span class="language-javascript">  <span class="title class_">Point</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">normalize</span> = <span class="keyword">function</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">var</span> length = <span class="variable language_">this</span>.<span class="title function_">length</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">x</span> /= length;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">y</span> /= length;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">return</span> <span class="variable language_">this</span>;</span></span><br><span class="line"><span class="language-javascript">  &#125;;</span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">return</span> <span class="title class_">Point</span>;</span></span><br><span class="line"><span class="language-javascript">&#125;)();</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"><span class="comment">/*</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * Particle class</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> */</span></span></span><br><span class="line"><span class="language-javascript"><span class="keyword">var</span> <span class="title class_">Particle</span> = (<span class="keyword">function</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">function</span> <span class="title function_">Particle</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">position</span> = <span class="keyword">new</span> <span class="title class_">Point</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">velocity</span> = <span class="keyword">new</span> <span class="title class_">Point</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">acceleration</span> = <span class="keyword">new</span> <span class="title class_">Point</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">age</span> = <span class="number">0</span>;</span></span><br><span class="line"><span class="language-javascript">  &#125;</span></span><br><span class="line"><span class="language-javascript">  <span class="title class_">Particle</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">initialize</span> = <span class="keyword">function</span>(<span class="params">x, y, dx, dy</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">position</span>.<span class="property">x</span> = x;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">position</span>.<span class="property">y</span> = y;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">velocity</span>.<span class="property">x</span> = dx;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">velocity</span>.<span class="property">y</span> = dy;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">acceleration</span>.<span class="property">x</span> = dx * settings.<span class="property">particles</span>.<span class="property">effect</span>;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">acceleration</span>.<span class="property">y</span> = dy * settings.<span class="property">particles</span>.<span class="property">effect</span>;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">age</span> = <span class="number">0</span>;</span></span><br><span class="line"><span class="language-javascript">  &#125;;</span></span><br><span class="line"><span class="language-javascript">  <span class="title class_">Particle</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">update</span> = <span class="keyword">function</span>(<span class="params">deltaTime</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">position</span>.<span class="property">x</span> += <span class="variable language_">this</span>.<span class="property">velocity</span>.<span class="property">x</span> * deltaTime;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">position</span>.<span class="property">y</span> += <span class="variable language_">this</span>.<span class="property">velocity</span>.<span class="property">y</span> * deltaTime;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">velocity</span>.<span class="property">x</span> += <span class="variable language_">this</span>.<span class="property">acceleration</span>.<span class="property">x</span> * deltaTime;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">velocity</span>.<span class="property">y</span> += <span class="variable language_">this</span>.<span class="property">acceleration</span>.<span class="property">y</span> * deltaTime;</span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">age</span> += deltaTime;</span></span><br><span class="line"><span class="language-javascript">  &#125;;</span></span><br><span class="line"><span class="language-javascript">  <span class="title class_">Particle</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">draw</span> = <span class="keyword">function</span>(<span class="params">context, image</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">function</span> <span class="title function_">ease</span>(<span class="params">t</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">return</span> (--t) * t * t + <span class="number">1</span>;</span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">var</span> size = image.<span class="property">width</span> * <span class="title function_">ease</span>(<span class="variable language_">this</span>.<span class="property">age</span> / settings.<span class="property">particles</span>.<span class="property">duration</span>);</span></span><br><span class="line"><span class="language-javascript">    context.<span class="property">globalAlpha</span> = <span class="number">1</span> - <span class="variable language_">this</span>.<span class="property">age</span> / settings.<span class="property">particles</span>.<span class="property">duration</span>;</span></span><br><span class="line"><span class="language-javascript">    context.<span class="title function_">drawImage</span>(image, <span class="variable language_">this</span>.<span class="property">position</span>.<span class="property">x</span> - size / <span class="number">2</span>, <span class="variable language_">this</span>.<span class="property">position</span>.<span class="property">y</span> - size / <span class="number">2</span>, size, size);</span></span><br><span class="line"><span class="language-javascript">  &#125;;</span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">return</span> <span class="title class_">Particle</span>;</span></span><br><span class="line"><span class="language-javascript">&#125;)();</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"><span class="comment">/*</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * ParticlePool class</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> */</span></span></span><br><span class="line"><span class="language-javascript"><span class="keyword">var</span> <span class="title class_">ParticlePool</span> = (<span class="keyword">function</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">var</span> particles,</span></span><br><span class="line"><span class="language-javascript">      firstActive = <span class="number">0</span>,</span></span><br><span class="line"><span class="language-javascript">      firstFree   = <span class="number">0</span>,</span></span><br><span class="line"><span class="language-javascript">      duration    = settings.<span class="property">particles</span>.<span class="property">duration</span>;</span></span><br><span class="line"><span class="language-javascript">  </span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">function</span> <span class="title function_">ParticlePool</span>(<span class="params">length</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// create and populate particle pool</span></span></span><br><span class="line"><span class="language-javascript">    particles = <span class="keyword">new</span> <span class="title class_">Array</span>(length);</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>; i &lt; particles.<span class="property">length</span>; i++)</span></span><br><span class="line"><span class="language-javascript">      particles[i] = <span class="keyword">new</span> <span class="title class_">Particle</span>();</span></span><br><span class="line"><span class="language-javascript">  &#125;</span></span><br><span class="line"><span class="language-javascript">  <span class="title class_">ParticlePool</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">add</span> = <span class="keyword">function</span>(<span class="params">x, y, dx, dy</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    particles[firstFree].<span class="title function_">initialize</span>(x, y, dx, dy);</span></span><br><span class="line"><span class="language-javascript">    </span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// handle circular queue</span></span></span><br><span class="line"><span class="language-javascript">    firstFree++;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">if</span> (firstFree   == particles.<span class="property">length</span>) firstFree   = <span class="number">0</span>;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">if</span> (firstActive == firstFree       ) firstActive++;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">if</span> (firstActive == particles.<span class="property">length</span>) firstActive = <span class="number">0</span>;</span></span><br><span class="line"><span class="language-javascript">  &#125;;</span></span><br><span class="line"><span class="language-javascript">  <span class="title class_">ParticlePool</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">update</span> = <span class="keyword">function</span>(<span class="params">deltaTime</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">var</span> i;</span></span><br><span class="line"><span class="language-javascript">    </span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// update active particles</span></span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">if</span> (firstActive &lt; firstFree) &#123;</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">for</span> (i = firstActive; i &lt; firstFree; i++)</span></span><br><span class="line"><span class="language-javascript">        particles[i].<span class="title function_">update</span>(deltaTime);</span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">if</span> (firstFree &lt; firstActive) &#123;</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">for</span> (i = firstActive; i &lt; particles.<span class="property">length</span>; i++)</span></span><br><span class="line"><span class="language-javascript">        particles[i].<span class="title function_">update</span>(deltaTime);</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">for</span> (i = <span class="number">0</span>; i &lt; firstFree; i++)</span></span><br><span class="line"><span class="language-javascript">        particles[i].<span class="title function_">update</span>(deltaTime);</span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">    </span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// remove inactive particles</span></span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">while</span> (particles[firstActive].<span class="property">age</span> &gt;= duration &amp;&amp; firstActive != firstFree) &#123;</span></span><br><span class="line"><span class="language-javascript">      firstActive++;</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">if</span> (firstActive == particles.<span class="property">length</span>) firstActive = <span class="number">0</span>;</span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">    </span></span><br><span class="line"><span class="language-javascript">    </span></span><br><span class="line"><span class="language-javascript">  &#125;;</span></span><br><span class="line"><span class="language-javascript">  <span class="title class_">ParticlePool</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">draw</span> = <span class="keyword">function</span>(<span class="params">context, image</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// draw active particles</span></span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">if</span> (firstActive &lt; firstFree) &#123;</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">for</span> (i = firstActive; i &lt; firstFree; i++)</span></span><br><span class="line"><span class="language-javascript">        particles[i].<span class="title function_">draw</span>(context, image);</span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">if</span> (firstFree &lt; firstActive) &#123;</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">for</span> (i = firstActive; i &lt; particles.<span class="property">length</span>; i++)</span></span><br><span class="line"><span class="language-javascript">        particles[i].<span class="title function_">draw</span>(context, image);</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">for</span> (i = <span class="number">0</span>; i &lt; firstFree; i++)</span></span><br><span class="line"><span class="language-javascript">        particles[i].<span class="title function_">draw</span>(context, image);</span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">  &#125;;</span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">return</span> <span class="title class_">ParticlePool</span>;</span></span><br><span class="line"><span class="language-javascript">&#125;)();</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"><span class="comment">/*</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * Putting it all together</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> */</span></span></span><br><span class="line"><span class="language-javascript">(<span class="keyword">function</span>(<span class="params">canvas</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">var</span> context = canvas.<span class="title function_">getContext</span>(<span class="string">&#x27;2d&#x27;</span>),</span></span><br><span class="line"><span class="language-javascript">      particles = <span class="keyword">new</span> <span class="title class_">ParticlePool</span>(settings.<span class="property">particles</span>.<span class="property">length</span>),</span></span><br><span class="line"><span class="language-javascript">      particleRate = settings.<span class="property">particles</span>.<span class="property">length</span> / settings.<span class="property">particles</span>.<span class="property">duration</span>, <span class="comment">// particles/sec</span></span></span><br><span class="line"><span class="language-javascript">      time;</span></span><br><span class="line"><span class="language-javascript">  </span></span><br><span class="line"><span class="language-javascript">  <span class="comment">// get point on heart with -PI &lt;= t &lt;= PI</span></span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">function</span> <span class="title function_">pointOnHeart</span>(<span class="params">t</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">Point</span>(</span></span><br><span class="line"><span class="language-javascript">      <span class="number">160</span> * <span class="title class_">Math</span>.<span class="title function_">pow</span>(<span class="title class_">Math</span>.<span class="title function_">sin</span>(t), <span class="number">3</span>),</span></span><br><span class="line"><span class="language-javascript">      <span class="number">130</span> * <span class="title class_">Math</span>.<span class="title function_">cos</span>(t) - <span class="number">50</span> * <span class="title class_">Math</span>.<span class="title function_">cos</span>(<span class="number">2</span> * t) - <span class="number">20</span> * <span class="title class_">Math</span>.<span class="title function_">cos</span>(<span class="number">3</span> * t) - <span class="number">10</span> * <span class="title class_">Math</span>.<span class="title function_">cos</span>(<span class="number">4</span> * t) + <span class="number">25</span></span></span><br><span class="line"><span class="language-javascript">    );</span></span><br><span class="line"><span class="language-javascript">  &#125;</span></span><br><span class="line"><span class="language-javascript">  </span></span><br><span class="line"><span class="language-javascript">  <span class="comment">// creating the particle image using a dummy canvas</span></span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">var</span> image = (<span class="keyword">function</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">var</span> canvas  = <span class="variable language_">document</span>.<span class="title function_">createElement</span>(<span class="string">&#x27;canvas&#x27;</span>),</span></span><br><span class="line"><span class="language-javascript">        context = canvas.<span class="title function_">getContext</span>(<span class="string">&#x27;2d&#x27;</span>);</span></span><br><span class="line"><span class="language-javascript">    canvas.<span class="property">width</span>  = settings.<span class="property">particles</span>.<span class="property">size</span>;</span></span><br><span class="line"><span class="language-javascript">    canvas.<span class="property">height</span> = settings.<span class="property">particles</span>.<span class="property">size</span>;</span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// helper function to create the path</span></span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">function</span> <span class="title function_">to</span>(<span class="params">t</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">var</span> point = <span class="title function_">pointOnHeart</span>(t);</span></span><br><span class="line"><span class="language-javascript">      point.<span class="property">x</span> = settings.<span class="property">particles</span>.<span class="property">size</span> / <span class="number">2</span> + point.<span class="property">x</span> * settings.<span class="property">particles</span>.<span class="property">size</span> / <span class="number">350</span>;</span></span><br><span class="line"><span class="language-javascript">      point.<span class="property">y</span> = settings.<span class="property">particles</span>.<span class="property">size</span> / <span class="number">2</span> - point.<span class="property">y</span> * settings.<span class="property">particles</span>.<span class="property">size</span> / <span class="number">350</span>;</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">return</span> point;</span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// create the path</span></span></span><br><span class="line"><span class="language-javascript">    context.<span class="title function_">beginPath</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">var</span> t = -<span class="title class_">Math</span>.<span class="property">PI</span>;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">var</span> point = <span class="title function_">to</span>(t);</span></span><br><span class="line"><span class="language-javascript">    context.<span class="title function_">moveTo</span>(point.<span class="property">x</span>, point.<span class="property">y</span>);</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">while</span> (t &lt; <span class="title class_">Math</span>.<span class="property">PI</span>) &#123;</span></span><br><span class="line"><span class="language-javascript">      t += <span class="number">0.01</span>; <span class="comment">// baby steps!</span></span></span><br><span class="line"><span class="language-javascript">      point = <span class="title function_">to</span>(t);</span></span><br><span class="line"><span class="language-javascript">      context.<span class="title function_">lineTo</span>(point.<span class="property">x</span>, point.<span class="property">y</span>);</span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">    context.<span class="title function_">closePath</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// create the fill</span></span></span><br><span class="line"><span class="language-javascript">    context.<span class="property">fillStyle</span> = <span class="string">&#x27;#ea80b0&#x27;</span>;</span></span><br><span class="line"><span class="language-javascript">    context.<span class="title function_">fill</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// create the image</span></span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">var</span> image = <span class="keyword">new</span> <span class="title class_">Image</span>();</span></span><br><span class="line"><span class="language-javascript">    image.<span class="property">src</span> = canvas.<span class="title function_">toDataURL</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">return</span> image;</span></span><br><span class="line"><span class="language-javascript">  &#125;)();</span></span><br><span class="line"><span class="language-javascript">  </span></span><br><span class="line"><span class="language-javascript">  <span class="comment">// render that thing!</span></span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">function</span> <span class="title function_">render</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// next animation frame</span></span></span><br><span class="line"><span class="language-javascript">    <span class="title function_">requestAnimationFrame</span>(render);</span></span><br><span class="line"><span class="language-javascript">    </span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// update time</span></span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">var</span> newTime   = <span class="keyword">new</span> <span class="title class_">Date</span>().<span class="title function_">getTime</span>() / <span class="number">1000</span>,</span></span><br><span class="line"><span class="language-javascript">        deltaTime = newTime - (time || newTime);</span></span><br><span class="line"><span class="language-javascript">    time = newTime;</span></span><br><span class="line"><span class="language-javascript">    </span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// clear canvas</span></span></span><br><span class="line"><span class="language-javascript">    context.<span class="title function_">clearRect</span>(<span class="number">0</span>, <span class="number">0</span>, canvas.<span class="property">width</span>, canvas.<span class="property">height</span>);</span></span><br><span class="line"><span class="language-javascript">    </span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// create new particles</span></span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">var</span> amount = particleRate * deltaTime;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>; i &lt; amount; i++) &#123;</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">var</span> pos = <span class="title function_">pointOnHeart</span>(<span class="title class_">Math</span>.<span class="property">PI</span> - <span class="number">2</span> * <span class="title class_">Math</span>.<span class="property">PI</span> * <span class="title class_">Math</span>.<span class="title function_">random</span>());</span></span><br><span class="line"><span class="language-javascript">      <span class="keyword">var</span> dir = pos.<span class="title function_">clone</span>().<span class="title function_">length</span>(settings.<span class="property">particles</span>.<span class="property">velocity</span>);</span></span><br><span class="line"><span class="language-javascript">      particles.<span class="title function_">add</span>(canvas.<span class="property">width</span> / <span class="number">2</span> + pos.<span class="property">x</span>, canvas.<span class="property">height</span> / <span class="number">2</span> - pos.<span class="property">y</span>, dir.<span class="property">x</span>, -dir.<span class="property">y</span>);</span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">    </span></span><br><span class="line"><span class="language-javascript">    <span class="comment">// update and draw particles</span></span></span><br><span class="line"><span class="language-javascript">    particles.<span class="title function_">update</span>(deltaTime);</span></span><br><span class="line"><span class="language-javascript">    particles.<span class="title function_">draw</span>(context, image);</span></span><br><span class="line"><span class="language-javascript">  &#125;</span></span><br><span class="line"><span class="language-javascript">  </span></span><br><span class="line"><span class="language-javascript">  <span class="comment">// handle (re-)sizing of the canvas</span></span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">function</span> <span class="title function_">onResize</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    canvas.<span class="property">width</span>  = canvas.<span class="property">clientWidth</span>;</span></span><br><span class="line"><span class="language-javascript">    canvas.<span class="property">height</span> = canvas.<span class="property">clientHeight</span>;</span></span><br><span class="line"><span class="language-javascript">  &#125;</span></span><br><span class="line"><span class="language-javascript">  <span class="variable language_">window</span>.<span class="property">onresize</span> = onResize;</span></span><br><span class="line"><span class="language-javascript">  </span></span><br><span class="line"><span class="language-javascript">  <span class="comment">// delay rendering bootstrap</span></span></span><br><span class="line"><span class="language-javascript">  <span class="built_in">setTimeout</span>(<span class="keyword">function</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="title function_">onResize</span>();</span></span><br><span class="line"><span class="language-javascript">    <span class="title function_">render</span>();</span></span><br><span class="line"><span class="language-javascript">  &#125;, <span class="number">10</span>);</span></span><br><span class="line"><span class="language-javascript">&#125;)(<span class="variable language_">document</span>.<span class="title function_">getElementById</span>(<span class="string">&#x27;pinkboard&#x27;</span>));</span></span><br><span class="line"><span class="language-javascript">  </span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">BODY</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">HTML</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h3 id="复制之后"><a href="#复制之后" class="headerlink" title="复制之后"></a>复制之后</h3><p>复制之后把他粘贴到代码编辑器，或者记事本都可以<br>粘贴完可以适当修改标题<br>修改完成之后保存，修改文件后缀名为html<br>右键选择打开方式浏览器打开即可</p>
<h3 id="完成之后"><a href="#完成之后" class="headerlink" title="完成之后"></a>完成之后</h3><p>点击下方按钮可以直接打开完成之后的样子<br><a href="https://www.freelypzd.cn/res/aixin/aixin.html">点击打开</a></p>
<h3 id="感觉太麻烦怎么办？"><a href="#感觉太麻烦怎么办？" class="headerlink" title="感觉太麻烦怎么办？"></a>感觉太麻烦怎么办？</h3><p>点击下方下载按钮直接下载成品<br><a href="https://www.freelypzd.cn/res/aixin/aixin.zip">本地下载</a></p>
<h2 id="添加按钮"><a href="#添加按钮" class="headerlink" title="添加按钮"></a>添加按钮</h2><h3 id="觉得不够神秘"><a href="#觉得不够神秘" class="headerlink" title="觉得不够神秘"></a>觉得不够神秘</h3><p>可以加一个界面，通过这个界面跳转到爱心的界面<br>如图所示：</p>
<p><img src="https://s2.loli.net/2023/01/09/38cf2UZwLuQCrGW.png" alt="a63a97a8a88ab0e7b6939a15fe372a0.png"></p>
<p>点击中间的按钮即可跳转到爱心的界面</p>
<h3 id="效果展示"><a href="#效果展示" class="headerlink" title="效果展示"></a>效果展示</h3><p>点击👉 <a href="https://www.freelypzd.cn/res/aixin/">示例</a></p>
<h2 id="代码"><a href="#代码" class="headerlink" title="代码"></a>代码</h2><p>代码是有两部分组成的，一部分html，一部分css，他们都放在一个文件夹内就可以</p>
<h3 id="html部分"><a href="#html部分" class="headerlink" title="html部分"></a>html部分</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;utf-8&quot;</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">title</span>&gt;</span>❤爱心实例<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">link</span> <span class="attr">rel</span>=<span class="string">&quot;stylesheet&quot;</span> <span class="attr">type</span>=<span class="string">&quot;text/css&quot;</span> <span class="attr">href</span>=<span class="string">&quot;style.css&quot;</span>/&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;aixin.html&quot;</span>&gt;</span>打开❤爱心<span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h3 id="CSS部分"><a href="#CSS部分" class="headerlink" title="CSS部分"></a>CSS部分</h3><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">*&#123;</span><br><span class="line">	<span class="attribute">margin</span>: <span class="number">0px</span>;</span><br><span class="line">	<span class="attribute">padding</span>: <span class="number">0px</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-tag">body</span>&#123;</span><br><span class="line">	<span class="attribute">background-color</span>: <span class="number">#000</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-tag">a</span>&#123;</span><br><span class="line">	<span class="attribute">text-decoration</span>: none;</span><br><span class="line">	<span class="attribute">position</span>: absolute;</span><br><span class="line">	<span class="attribute">left</span>: <span class="number">50%</span>;</span><br><span class="line">	<span class="attribute">top</span>: <span class="number">50%</span>;</span><br><span class="line">	<span class="attribute">transform</span>: <span class="built_in">translate</span>(-<span class="number">50%</span>,-<span class="number">50%</span>);</span><br><span class="line">	<span class="attribute">font-size</span>: <span class="number">24px</span>;</span><br><span class="line">	<span class="attribute">background</span>:<span class="built_in">linear-gradient</span>(<span class="number">90deg</span>,<span class="number">#03a9f4</span>,<span class="number">#f441a5</span>,<span class="number">#ffeb3b</span>,<span class="number">#03a9f4</span>);</span><br><span class="line">	<span class="attribute">background-size</span>: <span class="number">400%</span>;</span><br><span class="line">	<span class="attribute">width</span>: <span class="number">400px</span>;</span><br><span class="line">	<span class="attribute">height</span>: <span class="number">100px</span>;</span><br><span class="line">	<span class="attribute">line-height</span>: <span class="number">100px</span>;</span><br><span class="line">	<span class="attribute">text-align</span>: center;</span><br><span class="line">	<span class="attribute">color</span>: white;</span><br><span class="line">	<span class="attribute">text-transform</span>: uppercase;</span><br><span class="line">	<span class="attribute">border-radius</span>: <span class="number">50px</span>;</span><br><span class="line">	<span class="attribute">z-index</span>: <span class="number">1</span>;</span><br><span class="line">	</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-tag">a</span><span class="selector-pseudo">::before</span>&#123;</span><br><span class="line">	<span class="attribute">content</span>: <span class="string">&quot;&quot;</span>;</span><br><span class="line">	<span class="attribute">position</span>: absolute;</span><br><span class="line">	<span class="attribute">left</span>: -<span class="number">5px</span>;</span><br><span class="line">	<span class="attribute">right</span>: -<span class="number">5px</span>;</span><br><span class="line">	<span class="attribute">bottom</span>: -<span class="number">5px</span>;</span><br><span class="line">	<span class="attribute">top</span>: -<span class="number">5px</span>;</span><br><span class="line">	<span class="attribute">background</span>:<span class="built_in">linear-gradient</span>(<span class="number">90deg</span>,<span class="number">#03a9f4</span>,<span class="number">#f441a5</span>,<span class="number">#ffeb3b</span>,<span class="number">#03a9f4</span>);</span><br><span class="line">	<span class="attribute">background-size</span>: <span class="number">400%</span>;</span><br><span class="line">	<span class="attribute">border-radius</span>: <span class="number">50px</span>;</span><br><span class="line">	<span class="attribute">filter</span>: <span class="built_in">blur</span>(<span class="number">20px</span>);</span><br><span class="line">	<span class="attribute">z-index</span>: -<span class="number">1</span>;</span><br><span class="line">	</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-tag">a</span><span class="selector-pseudo">:hover</span><span class="selector-pseudo">::before</span>&#123;</span><br><span class="line">	<span class="attribute">animation</span>: sun <span class="number">8s</span> infinite;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">a</span><span class="selector-pseudo">:hover</span>&#123;</span><br><span class="line">	<span class="attribute">animation</span>: sun <span class="number">8s</span> infinite;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">@keyframes</span>  sun&#123;</span><br><span class="line">	<span class="number">100%</span>&#123;</span><br><span class="line">		<span class="attribute">background-position</span>: -<span class="number">400%</span> <span class="number">0</span>;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="提醒"><a href="#提醒" class="headerlink" title="提醒"></a>提醒</h3><p>也已将css写到html文件里style的标签中<br>根据自己的喜好适度修改✌</p>
<h3 id="成品"><a href="#成品" class="headerlink" title="成品"></a>成品</h3><p>点这👉 <a href="https://www.freelypzd.cn/res/aixin/aixinmax.zip">下载全部文件</a></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://www.freelypzd.cn">Freely.Pzd</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://www.freelypzd.cn/article/64334.html">https://www.freelypzd.cn/article/64334.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://www.freelypzd.cn" target="_blank">小庞博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E8%B6%A3%E5%91%B3%E4%BB%A3%E7%A0%81/">趣味代码</a></div><div class="post_share"><div class="social-share" data-image="https://s2.loli.net/2022/12/20/qViTKGCHS2AutNv.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/article/14885.html"><img class="prev-cover" src="https://s2.loli.net/2022/12/22/RIq2VOepBCPQ81H.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">eclipse下载太慢怎么办</div></div></a></div><div class="next-post pull-right"><a href="/article/16107.html"><img class="next-cover" src="https://s2.loli.net/2023/01/01/1GVwvpY7tbOAHhC.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Hello World</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://s2.loli.net/2022/12/22/bWEYZPUedl7wftp.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Freely.Pzd</div><div class="author-info__description">勇敢一点，会得到更多</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">4</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">3</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="http://wpa.qq.com/msgrd?v=3&amp;uin=3153376798&amp;site=qq&amp;menu=yes"><i class="iconfont icon-QQ"></i><span>添加QQ</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://gitee.com/freelypzd" target="_blank" title="Gitee"><i class="iconfont icon-gitee"></i></a><a class="social-icon" href="https://github.com/FreelyPZD" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:3153376798@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">不定时更新！</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%B6%E4%BD%9C%E7%88%B1%E5%BF%83%E9%9C%80%E8%A6%81%E6%BB%A1%E8%B6%B3%E7%9A%84%E6%9D%A1%E4%BB%B6"><span class="toc-number">1.</span> <span class="toc-text">制作爱心需要满足的条件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%88%B1%E5%BF%83%E7%95%8C%E9%9D%A2%E5%88%B6%E4%BD%9C"><span class="toc-number">2.</span> <span class="toc-text">爱心界面制作</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%95%88%E6%9E%9C%E5%9B%BE"><span class="toc-number">2.1.</span> <span class="toc-text">效果图</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BB%A3%E7%A0%81%E5%B1%95%E7%A4%BA"><span class="toc-number">2.2.</span> <span class="toc-text">代码展示</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%A4%8D%E5%88%B6%E4%B9%8B%E5%90%8E"><span class="toc-number">2.3.</span> <span class="toc-text">复制之后</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%8C%E6%88%90%E4%B9%8B%E5%90%8E"><span class="toc-number">2.4.</span> <span class="toc-text">完成之后</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%84%9F%E8%A7%89%E5%A4%AA%E9%BA%BB%E7%83%A6%E6%80%8E%E4%B9%88%E5%8A%9E%EF%BC%9F"><span class="toc-number">2.5.</span> <span class="toc-text">感觉太麻烦怎么办？</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E6%8C%89%E9%92%AE"><span class="toc-number">3.</span> <span class="toc-text">添加按钮</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%A7%89%E5%BE%97%E4%B8%8D%E5%A4%9F%E7%A5%9E%E7%A7%98"><span class="toc-number">3.1.</span> <span class="toc-text">觉得不够神秘</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%95%88%E6%9E%9C%E5%B1%95%E7%A4%BA"><span class="toc-number">3.2.</span> <span class="toc-text">效果展示</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BB%A3%E7%A0%81"><span class="toc-number">4.</span> <span class="toc-text">代码</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#html%E9%83%A8%E5%88%86"><span class="toc-number">4.1.</span> <span class="toc-text">html部分</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#CSS%E9%83%A8%E5%88%86"><span class="toc-number">4.2.</span> <span class="toc-text">CSS部分</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8F%90%E9%86%92"><span class="toc-number">4.3.</span> <span class="toc-text">提醒</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%88%90%E5%93%81"><span class="toc-number">4.4.</span> <span class="toc-text">成品</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/article/36384.html" title="Unturned未转变者 Windows SteamCMD 2023最新开服教程-全网最全"><img src="https://s2.loli.net/2023/01/01/HdumsMbn8i3JVpZ.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Unturned未转变者 Windows SteamCMD 2023最新开服教程-全网最全"/></a><div class="content"><a class="title" href="/article/36384.html" title="Unturned未转变者 Windows SteamCMD 2023最新开服教程-全网最全">Unturned未转变者 Windows SteamCMD 2023最新开服教程-全网最全</a><time datetime="2023-01-01T09:01:59.000Z" title="发表于 2023-01-01 17:01:59">2023-01-01</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/article/14885.html" title="eclipse下载太慢怎么办"><img src="https://s2.loli.net/2022/12/22/RIq2VOepBCPQ81H.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="eclipse下载太慢怎么办"/></a><div class="content"><a class="title" href="/article/14885.html" title="eclipse下载太慢怎么办">eclipse下载太慢怎么办</a><time datetime="2022-12-22T09:01:59.000Z" title="发表于 2022-12-22 17:01:59">2022-12-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/article/64334.html" title="抖音爱心代码制作教程"><img src="https://s2.loli.net/2022/12/20/qViTKGCHS2AutNv.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="抖音爱心代码制作教程"/></a><div class="content"><a class="title" href="/article/64334.html" title="抖音爱心代码制作教程">抖音爱心代码制作教程</a><time datetime="2022-11-25T09:01:59.000Z" title="发表于 2022-11-25 17:01:59">2022-11-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/article/16107.html" title="Hello World"><img src="https://s2.loli.net/2023/01/01/1GVwvpY7tbOAHhC.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Hello World"/></a><div class="content"><a class="title" href="/article/16107.html" title="Hello World">Hello World</a><time datetime="2022-11-24T09:01:59.000Z" title="发表于 2022-11-24 17:01:59">2022-11-24</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2022 - 2023 <span style="color:red;">❤</span> Freely.Pzd</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a href="https://icp.gov.moe/?keyword=20230929" target="_blank">萌ICP备20230929号</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>